package com.scau.phradmin.business.test.controller;


import com.scau.phradmin.business.contents.service.impl.HospitalServiceImpl;
import com.scau.phradmin.business.contents.service.impl.MedicineServiceImpl;
import com.scau.phradmin.business.contents.service.impl.NewsServiceImpl;
import com.scau.phradmin.business.doctor.service.DoctorService;
import com.scau.phradmin.business.healthRecord.service.HealthRecordService;
import com.scau.phradmin.business.user.service.impl.UserServiceImpl;
import com.scau.phradmin.common.util.PageDTO;
import com.scau.phradmin.domain.entity.Doctor;
import com.scau.phradmin.domain.entity.HealthRecord;
import com.scau.phradmin.domain.mapper.VipContentMapper;
import net.sf.jsqlparser.expression.LongValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用于测试thymeleaf模板
 * @author yuzhiyi
 * @date 2018/8/3 9:35
 */
@Controller
@RequestMapping("/doctor")
public class DoctorTestController {

	@RequestMapping("/home")
	public String home(ModelMap map){
		map.addAttribute("view","doctor/home/home");
		return "doctor/common/admin";
	}

	@Autowired
	private HealthRecordService healthRecordService;
	@RequestMapping("/lookUpHealthRecord")
	public String lookUpHealthRecord(@RequestParam(value = "page",defaultValue = "1")Integer page, ModelMap map){
		map.addAttribute("view","doctor/healthRecord/record-look");
		PageDTO<HealthRecord> res = healthRecordService.selectAll(page);
		map.addAttribute("healthRecords",res.getValue());
		map.addAttribute("maxPage",res.getMaxPage());
		map.addAttribute("currentPage",res.getCurrentPage());
		return "doctor/common/admin";
	}
	@RequestMapping("/addHealthRecord")
	public String addHealthRecord(ModelMap map){
		map.addAttribute("view","doctor/healthRecord/record-add");
		return "doctor/common/admin";
	}

	@Autowired
	private DoctorService doctorService;

	@RequestMapping("/doctorInfo")
	public String doctorInfo(ModelMap map){
		map.addAttribute("view","doctor/doctorInfo/doctorInfo");
		Doctor doctor = (Doctor) doctorService.selectByTelephone("111111111");
		map.addAttribute("doctor",doctor);

		return "doctor/common/admin";
	}
}
